{extend name="common:frm_base" /}
{block name="content"}
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body">
            <table id="LAY-user-manage" lay-filter="LAY-user-manage"></table>
            <script type="text/html" id="iconTpl">
                <img style="display: inline-block; width: 50%; height: 100%;" src={{ d.icon }}>
            </script>
            <script type="text/html" id="statusTpl">
                {{#  if(d.status == 1){ }}
                <input type="checkbox" lay-filter="status_change" field="status" table_name="forum"
                       id="{{d.id}}" checked lay-skin="switch" lay-text="开启|关闭">
                {{#  } else { }}
                <input type="checkbox" lay-filter="status_change" field="status" table_name="forum"
                       id="{{d.id}}" lay-skin="switch" lay-text="开启|关闭">
                {{#  } }}
            </script>
            <script type="text/html" id="table-useradmin-webuser">
                <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="apply">报名列表</a>
                <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit"><i
                        class="layui-icon layui-icon-edit"></i>编辑</a>
                <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i
                        class="layui-icon layui-icon-delete"></i>删除</a>
            </script>
        </div>
    </div>
</div>

<script>


    layui.config({
        base: '__LAYUIADMIN__/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'table'], function () {
        var $ = layui.$
            , form = layui.form
            , table = layui.table;

        //监听搜索
        form.on('submit(LAY-user-front-search)', function (data) {
            var field = data.field;
            //执行重载
            table.reload('LAY-user-manage', {
                where: field
                ,page: {
                    curr: 1 //重新从第 1 页开始
                }
            });
        });

        //用户管理
        table.render({
            elem: '#LAY-user-manage'
            , url: "{:url('Activity/ajaxApply',array('id'=>$id))}" //模拟接口
            , cols: [[
                {type: 'checkbox', fixed: 'left'}
                , {field: 'id', width: 100, title: 'ID', sort: true}
                , {field: 'nickname', title: '昵称', minWidth: 100}

                , {field: 'create_time', title: '报名时间', sort: true,}
            ]]
            , method: 'post'
            , page: true
            , limit: 30
            , height: 'full-50'
            , text: '对不起，加载出现异常！'
        });

        $('.layui-btn.layuiadmin-btn-useradmin').on('click', function () {
            var type = $(this).data('type');
            var url = "";
            if (type == 'add') {
                url = "{:url('Forum/add')}";
            }
            active[type] ? active[type].call(this, url, table) : '';
        });
    });
</script>
</body>
</html>
{/block}
